// run: $exec < input
#include <cstdio>

void reduce(int & x)
{
	for (; !(x & 1); x /= 2);
	for (; !(x % 3); x /= 3);
}

int main()
{
	int n, a, b;
	std::scanf("%d", &n);
	std::scanf("%d", &a);
	reduce(a);
	for (int i = 1; i < n; i++) {
		std::scanf("%d", &b);
		reduce(b);
		if (b != a) {
			std::printf("No\n");
			return 0;
		}
	}
	std::printf("Yes\n");
}

